package BeadSort;

public class Grav extends BeadSort implements Runnable{
	private int[] arr;
	private int space;
	
	public void run()
	{
		gravitron();//Wheee!
		
	}
	/*public gravity(){  //def con
		int[]arr=new int[0];  //create blank array
		arr[0] = 0; //set blank array data to 0
		this.arr=arr;
		this.space=0;
	}*/
	public Grav(int[] arr, int space){  //mod con
		this.arr=arr;
		System.out.println("Arr.length: " + arr.length);
		this.space=space;//SPAAAAACE!!!
	}
	private void gravitron()
	{
		int beadcount=0;

		for(int x=0; x<arr.length; x++)
		{
			if(arr[x]==1)
				beadcount++;
			arr[x]=0;
		}
		for(int x=arr.length-1; x>=0; x--)
		{
			if(beadcount>0)
			{
				arr[x]=1;
				beadcount--;
			}
		}
		System.out.println(space);
		System.out.println(arr.length+" "/*+super.abacus[space].length*/);
		super.setAbacusColumn(space, arr);
		
	}
}